Skip to content

Conversation

@ansd
Copy link
Member

@ansd ansd commented Mar 26, 2025

Prior to this commit, when a client consumed from an unavailable quorum queue, the following crash occurred:

{badmatch,{error,noproc}}
[{rabbit_quorum_queue,consume,3,[{file,\"rabbit_quorum_queue.erl\"},{line,993}]}

This commit fixes this bug by returning any error when registering a quorum queue consumer to rabbit_queue_type.

This commit also refactors errors returned by
rabbit_queue_type:consume/3 to simplify and ensure seperation of concerns.

For example prior to this commit, the channel did error formatting specifically for consuming from streams. It's better if the channel is unaware of what queue type it consumes from and have each queue type implementation format their own errors.

Jira: RMQ-1582

condition = ?V_1_0_AMQP_ERROR_INTERNAL_ERROR,
description = {utf8, Desc}}}}} ->
?assertEqual(
<<"failed consuming from quorum queue 'q-down' in vhost '/': noproc">>,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we replace the "noproc" with something like "the leader replica was unavailable or not elected"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally yes. However, noproc is an exit reason returned from https://www.erlang.org/doc/apps/stdlib/gen_statem.html#call/3. That function can return other exit reasons too. I'd like to avoid parsing and translating any possible exit reason from gen_statem:call/3. The alternative would be to log this Erlang term only in the server and not pass it down to the client app.

FWIW, I removed the noproc from the test expectation.

Prior to this commit, when a client consumed from an unavailable quorum
queue, the following crash occurred:
```
{badmatch,{error,noproc}}
[{rabbit_quorum_queue,consume,3,[{file,\"rabbit_quorum_queue.erl\"},{line,993}]}
```

This commit fixes this bug by returning any error when registering a
quorum queue consumer to rabbit_queue_type.

This commit also refactors errors returned by
rabbit_queue_type:consume/3 to simplify and ensure seperation of
concerns.

For example prior to this commit, the channel did error
formatting specifically for consuming from streams. It's better if
the channel is unaware of what queue type it consumes from and have each
queue type implementation format their own errors.
@ansd ansd marked this pull request as ready for review March 27, 2025 08:31
Copy link
Contributor

@kjnilsson kjnilsson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. Just a bit of formatting feedback.

@ansd ansd merged commit c151806 into main Mar 27, 2025
273 checks passed
@ansd ansd deleted the attach-qq-down branch March 27, 2025 10:30
mergify bot pushed a commit that referenced this pull request Mar 27, 2025
ansd added a commit that referenced this pull request Mar 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants